package wusiyuan.dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import entity.User_Address;
import util.C3P0Util;
import wusiyuan.dao.GetTheAddressDao;

public class GetTheAddressDaoImpl implements GetTheAddressDao {

	
	@Override
	public User_Address selectAddressByconsigneeAndPhone(String consignee, String phone) {
		User_Address user=null;
		QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());	
		String sql = "select * from user_addr where consignee = ? and phone = ?";
		Object[] pram ={consignee,phone};
		try {
		user=qr.query(sql, pram, new BeanHandler<User_Address>(User_Address.class));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return user;
	}

}
